home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5641 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com(Pete)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Overloading problem with kernal/Class read/write
  5. Date: 5 Feb 1996 21:49:52 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4f5u20$7bc@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: 38.8.60.2
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Feb 05, 1996 12:41:28 in article <Overloading problem with kernal/Class
  15. read/write>, 'clare@shell.portal.com (Clare Chu)' wrote: 
  16.  
  17.  
  18. >Hi, I'm sort of new to C++, so please bear with me. 
  19. >I wrote a little file class that has memberfunctions 
  20. >"read" and "write".  Those member functions use the 
  21. >kernal "read" and "write".  However when I try to 
  22. >link/load my program, the load map complains about 
  23. >the function signature of the kernal "read" and "write" 
  24. >as not being defined (it isn't the same signature 
  25. >as the File Class "read" and "write". 
  26. >I got around this by using "readin" and "writeout" 
  27. >as my member functions, but somehow this doesn't 
  28. >satisfy me.  There's got to be a way for me to use 
  29. >"read" and "write", is there? 
  30. >Can someone explain?  Thanks, Clare 
  31.  
  32. When you name your member functions the same as some 
  33. non-member, and you wish to call those non-member functions 
  34. from within a member, you must ust the global scope operator 
  35. to indicate your intent: 
  36.  
  37.    void File::write(...) 
  38.     { 
  39.        ::write(fd, ....); 
  40.  
  41. -- 
  42. Pete Grant 
  43. Kalevi, Inc. 
  44. Object Oriented Software Development
  45.